<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template visitor_ptr_t</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../variant/reference.html#header.boost.variant.visitor_ptr_hpp" title="Header &lt;boost/variant/visitor_ptr.hpp&gt;">
<link rel="prev" href="static_visitor.html" title="Class template static_visitor">
<link rel="next" href="visitor_ptr.html" title="Function template visitor_ptr">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="static_visitor.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.visitor_ptr_hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="visitor_ptr.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.visitor_ptr_t"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template visitor_ptr_t</span></h2>
<p>boost::visitor_ptr_t — Adapts a function pointer for use as a static visitor.</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../variant/reference.html#header.boost.variant.visitor_ptr_hpp" title="Header &lt;boost/variant/visitor_ptr.hpp&gt;">boost/variant/visitor_ptr.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> R<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="visitor_ptr_t.html" title="Class template visitor_ptr_t">visitor_ptr_t</a> <span class="special">:</span> <span class="keyword">public</span> <a class="link" href="static_visitor.html" title="Class template static_visitor">static_visitor</a><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="visitor_ptr_t.html#boost.visitor_ptr_tconstruct-copy-destruct">construct/copy/destruct</a></span>
  <span class="keyword">explicit</span> <a class="link" href="visitor_ptr_t.html#id-1_3_43_5_13_1_1_5-bb"><span class="identifier">visitor_ptr_t</span></a><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="special">*</span><span class="special">)</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="visitor_ptr_t.html#id-1_3_43_5_13_1_1_6-bb">static visitor interfaces</a></span>
  <span class="identifier">R</span> <a class="link" href="visitor_ptr_t.html#id-1_3_43_5_13_1_1_6_1_1-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="emphasis"><em><span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">forwarding</span><span class="special">-</span><span class="identifier">type</span></em></span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <span class="keyword">void</span> <a class="link" href="visitor_ptr_t.html#id-1_3_43_5_13_1_1_6_1_2-bb"><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">U</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.43.5.14.3.4"></a><h2>Description</h2>
<p>Adapts the function given at construction for use as a
        <a class="link" href="../variant/reference.html#variant.concepts.static-visitor" title="StaticVisitor">static visitor</a>
        of type <code class="computeroutput">T</code> with result type <code class="computeroutput">R</code>.</p>
<div class="refsect2">
<a name="id-1.3.43.5.14.3.4.3"></a><h3>
<a name="boost.visitor_ptr_tconstruct-copy-destruct"></a><code class="computeroutput">visitor_ptr_t</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="id-1_3_43_5_13_1_1_5-bb"></a><span class="identifier">visitor_ptr_t</span><span class="special">(</span><span class="identifier">R</span> <span class="special">(</span><span class="special">*</span><span class="special">)</span><span class="special">(</span><span class="identifier">T</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Effects:</span></p></td>
<td>Constructs the visitor with the given function.</td>
</tr></tbody>
</table></div>
</li></ol></div>
</div>
<div class="refsect2">
<a name="id-1.3.43.5.14.3.4.4"></a><h3>
<a name="id-1_3_43_5_13_1_1_6-bb"></a><code class="computeroutput">visitor_ptr_t</code> static visitor interfaces</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><a name="id-1_3_43_5_13_1_1_6_1-bb"></a><span class="identifier">R</span> <a name="id-1_3_43_5_13_1_1_6_1_1-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="emphasis"><em><span class="identifier">unspecified</span><span class="special">-</span><span class="identifier">forwarding</span><span class="special">-</span><span class="identifier">type</span></em></span> operand<span class="special">)</span><span class="special">;</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> U<span class="special">&gt;</span> <span class="keyword">void</span> <a name="id-1_3_43_5_13_1_1_6_1_2-bb"></a><span class="keyword">operator</span><span class="special">(</span><span class="special">)</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">U</span><span class="special">&amp;</span><span class="special">)</span><span class="special">;</span></pre>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Effects:</span></p></td>
<td>If passed a value or reference of type
              <code class="computeroutput">T</code>, it invokes the function given at
              construction, appropriately forwarding
              <code class="computeroutput">operand</code>.</td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td>Returns the result of the function invocation.</td>
</tr>
<tr>
<td><p><span class="term">Throws:</span></p></td>
<td>The overload taking a value or reference of type
              <code class="computeroutput">T</code> throws if the invoked function throws.
              The overload taking all other values <span class="emphasis"><em>always</em></span>
              throws <code class="computeroutput"><a class="link" href="bad_visit.html" title="Class bad_visit">bad_visit</a></code>.</td>
</tr>
</tbody>
</table></div>
</li></ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2002, 2003 Eric Friedman, Itay Maman<br>Copyright © 2014-2025 Antony Polukhin<p>Distributed under the Boost Software License, Version 1.0.
    (See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at 
    <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
    </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="static_visitor.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../variant/reference.html#header.boost.variant.visitor_ptr_hpp"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="visitor_ptr.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
